var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(t, e) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
    })(t, e);
}, function(t, e) {
    function n() {
        this.constructor = t;
    }
    o(t, e), t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype, 
    new n());
}), a = this && this.__decorate || function(t, e, n, o) {
    var a, i = arguments.length, r = i < 3 ? e : null === o ? o = Object.getOwnPropertyDescriptor(e, n) : o;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, n, o); else for (var c = t.length - 1; 0 <= c; c--) (a = t[c]) && (r = (i < 3 ? a(r) : 3 < i ? a(e, n, r) : a(e, n)) || r);
    return 3 < i && r && Object.defineProperty(e, n, r), r;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("Global"), s = e("AudioManager"), c = e("PopBackItemView"), l = e("GameConfig"), d = e("GameData"), u = e("LoadManager"), p = e("UIManager"), h = e("WebManager"), f = cc._decorator, g = f.ccclass, m = f.property, y = function(e) {
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        return t.light = null, t.sprite = null, t.rankLabel = null, t.nameLabel = null, 
        t.leftSprite = null, t.rightSprite = null, t.skeleton = null, t.combine = null, 
        t.box = null, t.btns = null, t;
    }
    return i(t, e), t.prototype.onLoad = function() {}, t.prototype.onEnable = function() {
        cc.systemEvent.on(this.text, this.callback, this), cc.tween(this.node).to(.1, {
            scale: 1.1
        }).to(.1, {
            scale: 1
        }).call(function() {}).start();
    }, t.prototype.onDisable = function() {
        cc.systemEvent.off(this.text, this.callback, this), e.prototype.onDisable.call(this);
    }, t.prototype.onClick = function(t) {
        l.GC.isFreeCombine && PD.checkObjParam("item", "rank", "number") && 1 == PD.data.item.rank ? this.callback() : this.myButton.onClick(t);
    }, t.prototype.closePnl = function() {
        var t;
        PD.checkObjParam("item", "rank", "number") && 1 == PD.data.item.rank ? (h.default.getInstance().sentLog("新增用户关闭首次合成弹窗"), 
        (t = p.default.getInstance().getPnl("start")).initHintOne(), l.GC.hints[2] && t.schedule(t.initHintThree, l.GC.hintInterval)) : (t = p.default.getInstance().getPnl("start")).initHintTwo(), 
        e.prototype.closePnl.call(this);
    }, t.prototype.init = function() {
        cc.tween(this.light).repeatForever(cc.tween().by(2, {
            angle: 60
        })).start(), PD.checkObjParam("item", "rank", "number") && (this.rankLabel.string = (PD.data.item.rank + 1).toString(), 
        this.nameLabel.string = r.G.getGunModel(PD.data.item.rank).m, u.default.getInstance().loadSpriteFrame({
            url: "image/arm2/" + r.G.getIdxByRank(PD.data.item.rank),
            sprite: this.sprite
        }), this.doEffect());
    }, t.prototype.doEffect = function() {
        var e = this;
        PD.checkObjParam("item", "rank", "number") && u.default.getInstance().loadRes({
            url: "image/arm2/" + r.G.getIdxByRank(PD.data.item.rank - 1),
            type: cc.SpriteFrame
        }).then(function(t) {
            e.leftSprite.spriteFrame = t, e.rightSprite.spriteFrame = t, e.leftSprite.node.x = -250, 
            e.rightSprite.node.x = 250, s.default.getInstance().playAudio("高级合成时带闪电的那个"), e.skeleton.setAnimation(0, "animation", !1), 
            e.skeleton.setCompleteListener(function() {
                e.skeleton.node.active = !1;
            }), e.scheduleOnce(function() {
                cc.tween(e.leftSprite.node).by(.25, {
                    position: cc.v3(250, 0)
                }).start(), cc.tween(e.rightSprite.node).by(.25, {
                    position: cc.v3(-250, 0)
                }).start(), e.scheduleOnce(function() {
                    s.default.getInstance().playAudio("合成音效1", 2), e.leftSprite.node.active = !1, e.rightSprite.node.active = !1, 
                    e.box.active = !0, e.btns.active = !0, e.combine.node.active = !0, e.combine.setAnimation(0, "animation", !1), 
                    e.combine.setCompleteListener(function() {
                        e.combine.node.active = !1;
                    });
                }, .25);
            }, .5);
        });
    }, t.prototype.callback = function() {
        var t = this;
        d.GD.updateNumber("diamond", 200), p.default.getInstance().barViews.forEach(function(t) {
            return t.refresh();
        }), p.default.getInstance().showToast({
            diamond: 200
        }, function() {
            t.closePnl();
        });
    }, a([ m(cc.Node) ], t.prototype, "light", void 0), a([ m(cc.Sprite) ], t.prototype, "sprite", void 0), 
    a([ m(cc.Label) ], t.prototype, "rankLabel", void 0), a([ m(cc.Label) ], t.prototype, "nameLabel", void 0), 
    a([ m(cc.Sprite) ], t.prototype, "leftSprite", void 0), a([ m(cc.Sprite) ], t.prototype, "rightSprite", void 0), 
    a([ m(sp.Skeleton) ], t.prototype, "skeleton", void 0), a([ m(sp.Skeleton) ], t.prototype, "combine", void 0), 
    a([ m(cc.Node) ], t.prototype, "box", void 0), a([ m(cc.Node) ], t.prototype, "btns", void 0), 
    a([ g ], t);
}(c.default);

n.default = y;